package com.zhhs.galaxyott.httpVolley.parser;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.zhhs.galaxyott.beans.MoreSpecialBean;
import com.zhhs.galaxyott.httpVolley.response.MoreSpeciaContentlResponse;

/**
 * 多专题解析器
 * 
 * 
 */
public class MoreSpecialContentParser extends BaseParser<MoreSpeciaContentlResponse> {

    @Override
    public MoreSpeciaContentlResponse parse(String jsonString) {
        MoreSpeciaContentlResponse mResponse = new MoreSpeciaContentlResponse();
        try {
            JSONObject mjson = new JSONObject(jsonString);
            if (mjson.getInt("errCode") == 0) {
                JSONArray result = mjson.getJSONArray("list");
                for (int i = 0; i < result.length(); i++) {
                    JSONObject jo = result.getJSONObject(i);
                    MoreSpecialBean bean = new MoreSpecialBean();

                    bean.setType_id(jo.optInt("typeId"));
                    bean.setContent_title(jo.optString("contentTitle"));
                    bean.setContent_type(jo.optInt("contentType"));
                    bean.setObject_id(jo.optInt("objectId"));
                    bean.setImage_url(jo.optString("imageUrl"));
                    bean.setContent_sort(jo.optInt("contentSort"));

                    mResponse.mMoreSpecialBeans.add(bean);
                }
            }
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return mResponse;
    }

}
